3.14.18 \(\int (c (d \tan (e+f x))^p)^n (a+i a \tan (e+f x))^3 \, dx\) [1318]

Optimal. Leaf size=132 \[ -\frac {3 a^3 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {4 a^3 \, _2F_1(1,1+n p;2+n p;i \tan (e+f x)) \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}-\frac {i a^3 \tan ^2(e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (2+n p)} \]

[Out]

-3*a^3*tan(f*x+e)*(c*(d*tan(f*x+e))^p)^n/f/(n*p+1)+4*a^3*hypergeom([1, n*p+1],[n*p+2],I*tan(f*x+e))*tan(f*x+e)
*(c*(d*tan(f*x+e))^p)^n/f/(n*p+1)-I*a^3*tan(f*x+e)^2*(c*(d*tan(f*x+e))^p)^n/f/(n*p+2)

________________________________________________________________________________________

Rubi [A]
time = 0.17, antiderivative size = 132, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 5, integrand size = 30, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {1600, 1970, 90, 66, 45} \begin {gather*} \frac {4 a^3 \tan (e+f x) \, _2F_1(1,n p+1;n p+2;i \tan (e+f x)) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+1)}-\frac {i a^3 \tan ^2(e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+2)}-\frac {3 a^3 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+1)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c*(d*Tan[e + f*x])^p)^n*(a + I*a*Tan[e + f*x])^3,x]

[Out]

(-3*a^3*Tan[e + f*x]*(c*(d*Tan[e + f*x])^p)^n)/(f*(1 + n*p)) + (4*a^3*Hypergeometric2F1[1, 1 + n*p, 2 + n*p, I
*Tan[e + f*x]]*Tan[e + f*x]*(c*(d*Tan[e + f*x])^p)^n)/(f*(1 + n*p)) - (I*a^3*Tan[e + f*x]^2*(c*(d*Tan[e + f*x]
)^p)^n)/(f*(2 + n*p))

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 66

Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[c^n*((b*x)^(m + 1)/(b*(m + 1)))*Hypergeometr
ic2F1[-n, m + 1, m + 2, (-d)*(x/c)], x] /; FreeQ[{b, c, d, m, n}, x] &&  !IntegerQ[m] && (IntegerQ[n] || (GtQ[
c, 0] &&  !(EqQ[n, -2^(-1)] && EqQ[c^2 - d^2, 0] && GtQ[-d/(b*c), 0])))

Rule 90

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandI
ntegrand[(a + b*x)^m*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, p}, x] && IntegersQ[m, n] &&
(IntegerQ[p] || (GtQ[m, 0] && GeQ[n, -1]))

Rule 1600

Int[(u_.)*(Px_)^(p_.)*(Qx_)^(q_.), x_Symbol] :> Int[u*PolynomialQuotient[Px, Qx, x]^p*Qx^(p + q), x] /; FreeQ[
q, x] && PolyQ[Px, x] && PolyQ[Qx, x] && EqQ[PolynomialRemainder[Px, Qx, x], 0] && IntegerQ[p] && LtQ[p*q, 0]

Rule 1970

Int[(u_.)*((c_.)*((d_)*((a_.) + (b_.)*(x_)))^(q_))^(p_), x_Symbol] :> Dist[(c*(d*(a + b*x))^q)^p/(a + b*x)^(p*
q), Int[u*(a + b*x)^(p*q), x], x] /; FreeQ[{a, b, c, d, q, p}, x] &&  !IntegerQ[q] &&  !IntegerQ[p]

Rubi steps

\begin {align*} \int \left (c (d \tan (e+f x))^p\right )^n (a+i a \tan (e+f x))^3 \, dx &=\frac {\text {Subst}\left (\int \frac {\left (c (d x)^p\right )^n (a+i a x)^3}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\text {Subst}\left (\int \frac {\left (c (d x)^p\right )^n (a+i a x)^2}{\frac {1}{a}-\frac {i x}{a}} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\left ((d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \frac {(d x)^{n p} (a+i a x)^2}{\frac {1}{a}-\frac {i x}{a}} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\left ((d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \left (-2 a^3 (d x)^{n p}+\frac {4 a^2 (d x)^{n p}}{\frac {1}{a}-\frac {i x}{a}}-a^2 (d x)^{n p} (a+i a x)\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {2 a^3 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}-\frac {\left (a^2 (d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int (d x)^{n p} (a+i a x) \, dx,x,\tan (e+f x)\right )}{f}+\frac {\left (4 a^2 (d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \frac {(d x)^{n p}}{\frac {1}{a}-\frac {i x}{a}} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {2 a^3 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {4 a^3 \, _2F_1(1,1+n p;2+n p;i \tan (e+f x)) \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}-\frac {\left (a^2 (d \tan (e+f x))^{-n p} \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \left (a (d x)^{n p}+\frac {i a (d x)^{1+n p}}{d}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {3 a^3 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {4 a^3 \, _2F_1(1,1+n p;2+n p;i \tan (e+f x)) \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}-\frac {i a^3 \tan ^2(e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (2+n p)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(981\) vs. \(2(132)=264\).
time = 8.80, size = 981, normalized size = 7.43 \begin {gather*} \frac {\cos ^3(e+f x) \left (\frac {\sec ^2(e+f x) (-i \cos (3 e)-\sin (3 e))}{2+n p}+\frac {(-3-2 n p+\cos (2 e)) \sec ^2(e) \left (-\frac {1}{2} i \cos (3 e)-\frac {1}{2} \sin (3 e)\right )}{(1+n p) (2+n p)}+\frac {(-\cos (e-f x)+\cos (e+f x)) \sec ^2(e) \sec (e+f x) \left (-\frac {1}{2} i \cos (3 e)-\frac {1}{2} \sin (3 e)\right )}{1+n p}\right ) \left (c (d \tan (e+f x))^p\right )^n (a+i a \tan (e+f x))^3}{f (\cos (f x)+i \sin (f x))^3}+\frac {\cos ^3(e+f x) \left (\frac {\sec ^2(e) (-1+\cos (2 e)+3 i \sin (2 e)) \left (\frac {1}{2} i \cos (3 e)+\frac {1}{2} \sin (3 e)\right )}{1+n p}+\frac {\sec ^2(e) \sec (e+f x) \left (\frac {1}{2} i \cos (3 e)+\frac {1}{2} \sin (3 e)\right ) (-\cos (e-f x)+\cos (e+f x)-3 i \sin (e-f x)+3 i \sin (e+f x))}{1+n p}\right ) \left (c (d \tan (e+f x))^p\right )^n (a+i a \tan (e+f x))^3}{f (\cos (f x)+i \sin (f x))^3}+\frac {i 2^{2-n p} \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^{n p} \cos ^3(e+f x) \left (2^{n p} \, _2F_1\left (1,n p;1+n p;-\frac {-1+e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )-\left (1+e^{2 i (e+f x)}\right )^{n p} \, _2F_1\left (n p,n p;1+n p;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )\right ) \tan ^{-n p}(e+f x) \left (c (d \tan (e+f x))^p\right )^n (a+i a \tan (e+f x))^3}{\left (e^{i e}+e^{3 i e}\right ) f n p (\cos (f x)+i \sin (f x))^3}-\frac {4 i e^{-3 i e} \left (-1+e^{2 i (e+f x)}\right )^{n p} \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^{n p} \left (\frac {-1+e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^{-n p} \cos ^3(e+f x) \left (-\frac {\left (1+e^{2 i (e+f x)}\right )^{-n p} \, _2F_1\left (1,n p;1+n p;\frac {1-e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )}{n p}-\frac {\left (1+e^{2 i e}\right ) \left (-1+e^{2 i (e+f x)}\right ) \left (1+e^{2 i (e+f x)}\right )^{-1-n p} \, _2F_1\left (1,1+n p;2+n p;\frac {1-e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )}{1+n p}+\frac {2^{-n p} \, _2F_1\left (n p,n p;1+n p;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )}{n p}\right ) \tan ^{-n p}(e+f x) \left (c (d \tan (e+f x))^p\right )^n (a+i a \tan (e+f x))^3}{\left (1+e^{2 i e}\right ) f (\cos (f x)+i \sin (f x))^3} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

Integrate[(c*(d*Tan[e + f*x])^p)^n*(a + I*a*Tan[e + f*x])^3,x]

[Out]

(Cos[e + f*x]^3*((Sec[e + f*x]^2*((-I)*Cos[3*e] - Sin[3*e]))/(2 + n*p) + ((-3 - 2*n*p + Cos[2*e])*Sec[e]^2*((-
1/2*I)*Cos[3*e] - Sin[3*e]/2))/((1 + n*p)*(2 + n*p)) + ((-Cos[e - f*x] + Cos[e + f*x])*Sec[e]^2*Sec[e + f*x]*(
(-1/2*I)*Cos[3*e] - Sin[3*e]/2))/(1 + n*p))*(c*(d*Tan[e + f*x])^p)^n*(a + I*a*Tan[e + f*x])^3)/(f*(Cos[f*x] +
I*Sin[f*x])^3) + (Cos[e + f*x]^3*((Sec[e]^2*(-1 + Cos[2*e] + (3*I)*Sin[2*e])*((I/2)*Cos[3*e] + Sin[3*e]/2))/(1
 + n*p) + (Sec[e]^2*Sec[e + f*x]*((I/2)*Cos[3*e] + Sin[3*e]/2)*(-Cos[e - f*x] + Cos[e + f*x] - (3*I)*Sin[e - f
*x] + (3*I)*Sin[e + f*x]))/(1 + n*p))*(c*(d*Tan[e + f*x])^p)^n*(a + I*a*Tan[e + f*x])^3)/(f*(Cos[f*x] + I*Sin[
f*x])^3) + (I*2^(2 - n*p)*(((-I)*(-1 + E^((2*I)*(e + f*x))))/(1 + E^((2*I)*(e + f*x))))^(n*p)*Cos[e + f*x]^3*(
2^(n*p)*Hypergeometric2F1[1, n*p, 1 + n*p, -((-1 + E^((2*I)*(e + f*x)))/(1 + E^((2*I)*(e + f*x))))] - (1 + E^(
(2*I)*(e + f*x)))^(n*p)*Hypergeometric2F1[n*p, n*p, 1 + n*p, (1 - E^((2*I)*(e + f*x)))/2])*(c*(d*Tan[e + f*x])
^p)^n*(a + I*a*Tan[e + f*x])^3)/((E^(I*e) + E^((3*I)*e))*f*n*p*(Cos[f*x] + I*Sin[f*x])^3*Tan[e + f*x]^(n*p)) -
 ((4*I)*(-1 + E^((2*I)*(e + f*x)))^(n*p)*(((-I)*(-1 + E^((2*I)*(e + f*x))))/(1 + E^((2*I)*(e + f*x))))^(n*p)*C
os[e + f*x]^3*(-(Hypergeometric2F1[1, n*p, 1 + n*p, (1 - E^((2*I)*(e + f*x)))/(1 + E^((2*I)*(e + f*x)))]/((1 +
 E^((2*I)*(e + f*x)))^(n*p)*n*p)) - ((1 + E^((2*I)*e))*(-1 + E^((2*I)*(e + f*x)))*(1 + E^((2*I)*(e + f*x)))^(-
1 - n*p)*Hypergeometric2F1[1, 1 + n*p, 2 + n*p, (1 - E^((2*I)*(e + f*x)))/(1 + E^((2*I)*(e + f*x)))])/(1 + n*p
) + Hypergeometric2F1[n*p, n*p, 1 + n*p, (1 - E^((2*I)*(e + f*x)))/2]/(2^(n*p)*n*p))*(c*(d*Tan[e + f*x])^p)^n*
(a + I*a*Tan[e + f*x])^3)/(E^((3*I)*e)*(1 + E^((2*I)*e))*((-1 + E^((2*I)*(e + f*x)))/(1 + E^((2*I)*(e + f*x)))
)^(n*p)*f*(Cos[f*x] + I*Sin[f*x])^3*Tan[e + f*x]^(n*p))

________________________________________________________________________________________

Maple [F]
time = 0.17, size = 0, normalized size = 0.00 \[\int \left (c \left (d \tan \left (f x +e \right )\right )^{p}\right )^{n} \left (a +i a \tan \left (f x +e \right )\right )^{3}\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c*(d*tan(f*x+e))^p)^n*(a+I*a*tan(f*x+e))^3,x)

[Out]

int((c*(d*tan(f*x+e))^p)^n*(a+I*a*tan(f*x+e))^3,x)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*(d*tan(f*x+e))^p)^n*(a+I*a*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

integrate((I*a*tan(f*x + e) + a)^3*((d*tan(f*x + e))^p*c)^n, x)

________________________________________________________________________________________

Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*(d*tan(f*x+e))^p)^n*(a+I*a*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

integral(8*a^3*e^(n*p*log((-I*d*e^(2*I*f*x + 2*I*e) + I*d)/(e^(2*I*f*x + 2*I*e) + 1)) + 6*I*f*x + n*log(c) + 6
*I*e)/(e^(6*I*f*x + 6*I*e) + 3*e^(4*I*f*x + 4*I*e) + 3*e^(2*I*f*x + 2*I*e) + 1), x)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - i a^{3} \left (\int i \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n}\, dx + \int \left (- 3 \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n} \tan {\left (e + f x \right )}\right )\, dx + \int \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n} \tan ^{3}{\left (e + f x \right )}\, dx + \int \left (- 3 i \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n} \tan ^{2}{\left (e + f x \right )}\right )\, dx\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*(d*tan(f*x+e))**p)**n*(a+I*a*tan(f*x+e))**3,x)

[Out]

-I*a**3*(Integral(I*(c*(d*tan(e + f*x))**p)**n, x) + Integral(-3*(c*(d*tan(e + f*x))**p)**n*tan(e + f*x), x) +
 Integral((c*(d*tan(e + f*x))**p)**n*tan(e + f*x)**3, x) + Integral(-3*I*(c*(d*tan(e + f*x))**p)**n*tan(e + f*
x)**2, x))

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c*(d*tan(f*x+e))^p)^n*(a+I*a*tan(f*x+e))^3,x, algorithm="giac")

[Out]

integrate((I*a*tan(f*x + e) + a)^3*((d*tan(f*x + e))^p*c)^n, x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (c\,{\left (d\,\mathrm {tan}\left (e+f\,x\right )\right )}^p\right )}^n\,{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^3 \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c*(d*tan(e + f*x))^p)^n*(a + a*tan(e + f*x)*1i)^3,x)

[Out]

int((c*(d*tan(e + f*x))^p)^n*(a + a*tan(e + f*x)*1i)^3, x)

________________________________________________________________________________________